//
//  FQOrganizationPhoneHeaderView.swift
//  SwiftProject
//
//  Created by 董駸 on 2022/9/5.
//

import UIKit

class FQOrganizationPhoneHeaderView: UIView {
    let imageV = UIImageView()
    let titleLb = QMUILabel(font: .rSFont(15), textColor: .color102)
    let phoneLb = QMUILabel(font: .rSFont(14), textColor: .color102)
    
    var model : String! {
        didSet {
            imageV.image = UIImage(named: "AppIcon60x60")
            titleLb.text = "宝银钱包"
            phoneLb.text = YHBaseConfiguration.shared.configModel?.customerServiceNum
        }
    }
    
    convenience init() {
        self.init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 152))
        
        let whiteV = UIView()
        whiteV.backgroundColor = .white
        whiteV.clipsToBounds = true
        whiteV.layer.cornerRadius = 8
        addSubview(whiteV)
        
        whiteV.snp.makeConstraints { make in
            make.left.top.equalTo(16)
            make.right.bottom.equalTo(-16)
        }
        
        let titleLb1 = QMUILabel(font: .mSFont(16), textColor: .color51)
        titleLb1.text = "平台官方客服电话"
        whiteV.addSubview(titleLb1)
        
        titleLb1.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalToSuperview()
            make.height.equalTo(58)
        }
        
        let buttonV = QMUIButton()
        buttonV.qmui_borderColor = .color238
        buttonV.qmui_borderWidth = 0.5
        buttonV.qmui_borderPosition = .top
        whiteV.addSubview(buttonV)
        
        buttonV.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.top.equalTo(titleLb1.snp.bottom)
            make.bottom.equalToSuperview()
        }
        
        imageV.clipsToBounds = true
        imageV.layer.cornerRadius = 8
        buttonV.addSubview(imageV)
        
        imageV.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview()
            make.size.equalTo(38)
        }
        
        buttonV.addSubview(titleLb)
        titleLb.snp.makeConstraints { make in
            make.left.equalTo(imageV.snp.right).offset(8)
            make.centerY.equalToSuperview()
        }
        
        buttonV.addSubview(phoneLb)
        phoneLb.snp.makeConstraints { make in
            make.right.equalToSuperview()
            make.centerY.equalToSuperview()
        }
    }

}
